﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data;
using Jb.Common.Extensions;
using Jb.Domain;
using Jb.Web.ViewModels;
using Jb.Web.Utility;
using AutoMapper;
using Jb.Web.ViewModels.UtilityModels;

namespace Jb.Web.Areas.JobSeeker.Controllers
{
    [Authorize(Roles = "Job Seeker,Admin")]
    public class InterviewRequestController : BaseController
    {
		private JbEntities _Context = new JbEntities();
        
		#region Constructors
		public InterviewRequestController()
		{
		}

		public InterviewRequestController(UserViewModel currentUser)
			: base(currentUser)
        {
        }
		#endregion Constructors

		#region Action Methods
        public ActionResult Index()
        {
            return View("List", BuildInterviewRequestListConfig());
        }

		public ActionResult List()
        {
            return View(BuildInterviewRequestListConfig());
        }
			
		#endregion Action Methods
		
		#region Helper Methods

		/// <summary>
        /// Builds a ListConfig object with a list of InterviewRequest
        /// </summary>
        /// <returns></returns>
		private ListConfig BuildInterviewRequestListConfig()
		{
			UtilityDAO dao = new UtilityDAO();
            Jb.Domain.DbParameter[] parameters = new[]{
                new Jb.Domain.DbParameter("@JobSeekerID", LoggedInUser.JobSeekerID)
            };
            DataSet ds = dao.GetDataSet(DbObject.SP.GET_INTERVIEWREQUESTS_BY_JOBSEEKER, parameters, true);
            ListConfig listConfig = new ListConfig(ds.Tables[0], null);
            return listConfig;
		}

        #endregion			
    }
}


